package com.baiyun.yunpan.dao;

import com.baiyun.yunpan.entity.Share;
import com.baiyun.yunpan.entity.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.Date;

/**
 * @author Sam
 * @date 2021/5/25 11:53
 */
public interface ShareDao {
    @Insert("insert into share values(null,#{userid},#{sharelink},#{downloadlink},#{expiredate})")
    public void addShare(Share share);

    @Select("SELECT @@IDENTITY")
    public int getId();

    @Select("select * from share where shareid = #{shareid}")
    public Share getShare(int shareid);

    @Delete("delete from share where shareid=#{shareid}")
    public void delete(int shareid);

    @Update("update share set expiredate=#{expiredate} where shareid=#{shareid}")
    public void uodate(Share share);
}
